<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">


    <h:head>

        <h:outputStylesheet library="css" name="style.css"/>   
        <f:metadata>  http-equiv="Content-Type" content="text/html; charset=UTF-8"</f:metadata>   
        <f:metadata>  name="description" content="Gestion d'utilisateurs" </f:metadata>
        <f:metadata>  http-equiv="Content-Language" content="fr" </f:metadata>
        <title>Gestionnaire d'articles</title>     
    </h:head>

    <h:body>




        <div id="entete">
            <table class="noStyle">
                <tr class="noStyle">
                    <td class="noStyle" width="60%">
                        <div class="titreAppli"><h1>Gestionnaire d'articles</h1></div>
                    </td>
                    <td class="noStyle" width="40%">
                        <img src="ressources/user.png" alt="logoUser" border="0" class="imgUser"/>
                    </td>
                </tr>
            </table>
        </div>

        <div id="centre">

            <h:form id="testeFormConnectPasOKAcheteur" rendered="#{!managementBean.connectedAdmin and !managementBean.connectedUser}"> 
                <div id="centreleft">
                    <div id="content" class="left_content">
                        <div>
                            <fieldset>
                                <legend>Formulaire d'identification Acheteur: </legend>

                                <table><tr><td>
                                            
                                            <h:body>
                                                <h:outputText rendered="#{!managementBean.connectedAdmin and !managementBean.connectedUser}" value="#{managementBean.message}" /> 

                                                <h:form id="loginForm"> <br /><br />
                                                    Login : <h:inputText id="loginForm" value="#{managementBean.loginA}" /> <br />
                                                    Password : <h:inputText id="password" value="#{managementBean.passwordA}" /> <br /><br />
                                                    <h:commandButton value="Login" action="#{managementBean.checkLoginAcheteur}" />
                                                </h:form> 

                                                <h:form id="deconnexionForm" rendered="#{managementBean.connectedAdmin || managementBean.connectedUser}"> 
                                                    <h:outputText  value="#{managementBean.message}" />
                                                    <h:commandButton value="Deconnexion" action="#{managementBean.deconnexion}" /> 
                                                </h:form> 

                                            </h:body>
                                            
                                        </td><td>
                                            
                                            <h:panelGrid columns="2" border="1" cellpadding="0" cellspacing="2">
                                                <h:outputLabel value="Prenom :" for="firstName" />
                                                <h:inputText id="firstName" value="#{managementBean.acheteurNew.firstName}" title="firstName" />
                                                <h:outputLabel value="Nom :" for="name" />
                                                <h:inputText id="name" value="#{managementBean.acheteurNew.name}" title="name" />

                                                <h:outputLabel value="Login :" for="login" />
                                                <h:inputText id="login" value="#{managementBean.acheteurNew.login}" title="login" />
                                                <h:outputLabel value="Mot de passe :" for="password" />
                                                <h:inputText id="password" value="#{managementBean.acheteurNew.password}" title="password" />

                                                <h:outputLabel value="Adresse :" for="adress" />
                                                <h:inputText id="adress" value="#{managementBean.acheteurNew.adress}" title="adress" />
                                                
                                                <h:outputLabel value="lat :" for="lat" />
                                                <h:inputText id="lat" value="#{managementBean.acheteurNew.lat}" title="lat" />
                                                <h:outputLabel value="lng :" for="lng" />
                                                <h:inputText id="lng" value="#{managementBean.acheteurNew.lng}" title="lng" />

                                            </h:panelGrid>
                                            <br />
                                            <center><h:commandButton action="#{managementBean.creerUnAcheteur()}" value="s'inscrire"/></center>

                                        </td></tr></table>
                            </fieldset>



                        </div> 
                    </div>  
                </div>
            </h:form> 
            <h:form id="testeFormConnectPasOKVendeur" rendered="#{!managementBean.connectedAdmin and !managementBean.connectedUser}"> 
                <div id="centreleft">
                    <div id="content" class="left_content">
                        <div>
                            <fieldset>
                                <legend>Formulaire d'identification Vendeur: </legend>

                                <table><tr><td>
                                            <h:body>
                                                <h:outputText rendered="#{!managementBean.connectedAdmin and !managementBean.connectedUser}" value="#{managementBean.message}" /> 

                                                <h:form id="loginForm"> <br /><br />
                                                    Login : <h:inputText id="loginForm" value="#{managementBean.loginV}" /> <br />
                                                    Password : <h:inputText id="password" value="#{managementBean.passwordV}" /> <br /><br />
                                                    <h:commandButton value="Login" action="#{managementBean.checkLoginVendeur}" /> 
                                                </h:form> 

                                                <h:form id="deconnexionForm" rendered="#{managementBean.connectedAdmin || managementBean.connectedUser}"> 
                                                    <h:outputText  value="#{managementBean.message}" />
                                                    <h:commandButton value="Deconnexion" action="#{managementBean.deconnexion}" /> 
                                                </h:form> 

                                            </h:body>

                                        </td><td>

                                            <h:panelGrid columns="2" border="1" cellpadding="0" cellspacing="2">
                                                <h:outputLabel value="Prenom :" for="firstName" />
                                                <h:inputText id="firstName" value="#{managementBean.vendeurNew.firstName}" title="firstName" />
                                                <h:outputLabel value="Nom :" for="name" />
                                                <h:inputText id="name" value="#{managementBean.vendeurNew.name}" title="name" />

                                                <h:outputLabel value="Login :" for="login" />
                                                <h:inputText id="login" value="#{managementBean.vendeurNew.login}" title="login" />
                                                <h:outputLabel value="Mot de passe :" for="password" />
                                                <h:inputText id="password" value="#{managementBean.vendeurNew.password}" title="password" />

                                                <h:outputLabel value="Adresse :" for="adress" />
                                                <h:inputText id="adress" value="#{managementBean.vendeurNew.adress}" title="adress" />

                                            </h:panelGrid>
                                            <br />
                                            <center><h:commandButton action="#{managementBean.creerUnVendeur()}" value="s'inscrire"/></center>

                                        </td></tr></table>
                            </fieldset>


                        </div> 
                    </div>  
                </div>
            </h:form> 

            <h:form id="testeFormConnectOKadmin" rendered="#{managementBean.connectedAdmin}"> 
                <div id="centreLeft">
                    <center><h2><h:outputText value="Menu d'admin"/></h2></center>
                    <ul>
                        <li><h:commandLink action="#{managementBean.afficherMagasins()}" value="Afficher les magasins"/> </li>
                    </ul>     
                </div>

                <div id="centreRight">
                    <div id="content" class="left_content">
                        <center><h2><ui:insert name="complementTitreEtH1"/>#{numEx}</h2></center>  
                        <ui:insert name="content">Content</ui:insert>  
                    </div>  
                </div>
            </h:form>

            <h:form id="testeFormConnectOKuser" rendered="#{managementBean.connectedUser}"> 
                <div id="centreLeft">
                    <center><h2><h:outputText value="Menu d'utilisateur"/></h2></center>
                    <ul>
                        <li><h:commandLink action="#{managementBean.afficherPanier()}" value="Afficher le panier"/> </li>
                        <li><h:commandLink action="#{managementBean.afficherMagasinsDispo()}" value="Afficher tous les magasins"/> </li>
                        <li><h:commandLink action="#{managementBean.afficherRechercheMagasin()}" value="Chercher un magasin"/> </li>
                        <li><h:commandLink action="#{managementBean.afficherArticles()}" value="Afficher tous les articles"/> </li>
                    </ul>     
                </div>

                <div id="centreRight">
                    <div id="content" class="left_content">
                        <center><h2><ui:insert name="complementTitreEtH1"/>#{numEx}</h2></center>  
                        <ui:insert name="content">Content</ui:insert>  
                    </div>  
                </div>
            </h:form>


        </div>
    </h:body> 

    <br />

    <center>
        <h:form id="deconnexionForm" rendered="#{managementBean.connectedAdmin || managementBean.connectedUser}"> 
            <div style="font-size: 10px; color:#424242; align:left;"><h:outputText  value="#{managementBean.message}"/></div><br />
            <h:commandButton value="Deconnexion" action="#{managementBean.deconnexion}" /> 
        </h:form>
    </center>

</html>







